//=============================================================
// 创建人:            ssd
// 创建时间:          8/8/2024 12:30:10 AM
// 邮箱：             1292934053@qq.com
//==============================================================
using LF.Domain.Entities;
using LF.Domain;

namespace LF.Domain.Services
{
    public interface IUserManagerService: IDomainService
    {
        List<User> All(int index, int pageSize, string? key, string? deptId);
        /// <summary>
        /// 获取所有用户（无分页）
        /// </summary>
        /// <param name="key">搜索关键字</param>
        /// <param name="deptId">部门ID</param>
        /// <returns></returns>
        List<User> GetAllUsers(string? key = null, string? deptId = null);
        long Count(string? key, string? deptId = null);
        User Get(Guid id);
        User GetUserByOpenId(string openid);
        User GetUserByQyWeixinId(string qyWeixinUserId);
        /// <summary>
        /// 检查会员是否在
        /// </summary>
        /// <param name="openId"></param>
        /// <param name="usercode"></param>
        /// <returns></returns>
        bool CheckUser(string openId, string usercode);
        /// <summary>
        /// 物理删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool RealDelete(Guid id);
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        bool Delete(Guid[] ids);

        bool Disabled(Guid id);
        bool Actived(Guid id);

        bool Insert(User user);
        bool Update(User user);
        /// <summary>
        /// 用户权限
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        List<UserRole> Roles(Guid id);
        /// <summary>
        /// 批量添加用户权限
        /// </summary>
        /// <param name="roles"></param>
        /// <returns></returns>
        bool AddRoles(List<UserRole> roles);
        /// <summary>
        /// 清除用户权限
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <returns></returns>
        bool ClearRoles(Guid id);
        /// <summary>
        /// 取得用户菜单权限
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        List<RoleMenu> Menus(Guid id);
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        bool ResetPwd(Guid id, string pwd);
        
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <param name="oldPassword">旧密码（已加密）</param>
        /// <param name="newPassword">新密码（已加密）</param>
        /// <returns>修改是否成功</returns>
        bool ChangePassword(Guid id, string oldPassword, string newPassword);
    }
}